package com.cloudz.iptv.fragment.footer.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.cloudz.iptv.App;
import com.cloudz.iptv.R;
import com.cloudz.iptv.fragment.footer.adapter.data.ItemMenuFooter;
import com.owen.adapter.CommonRecyclerViewAdapter;
import com.owen.adapter.CommonRecyclerViewHolder;
import com.owen.adapter.CommonViewHolder;

import java.util.List;

/**
 * 底部菜单适配器
 */
public class MenuFooterAdapter extends CommonRecyclerViewAdapter
{
    public MenuFooterAdapter(Context context, List datas)
    {
        super(context, datas);
    }

    @Override
    public int getItemLayoutId(int viewType)
    {
        return R.layout.item_list_menu_footer;
    }

    @Override
    public void onBindItemHolder(CommonRecyclerViewHolder helper, Object item, int position)
    {
        ItemMenuFooter itemMenuFooter = (ItemMenuFooter) item;

        CommonViewHolder holder = helper.getHolder();
        holder.setText(R.id.footer_menus_title, itemMenuFooter.title);
        holder.setImageResource(R.id.footer_menus_img, itemMenuFooter.drawableId);
        //showImage(helper, R.id.footer_menus_img, item.);
    }

    public void showImage(CommonRecyclerViewHolder helper, int viewId, String url)
    {
        ImageView imageView = helper.getHolder().getView(viewId);
        Glide.with(App.get()).load(url).into(imageView);
    }
}
